import Vue from 'vue'
import App from './App.vue'
// 使用封装的 element
// import "../plugins/element"
// 使用全局 elemnt
import ElementUI from "element-ui"
import 'element-ui/lib/theme-chalk/index.css'
// 引入图标库
import "font-awesome/css/font-awesome.min.css"
import service from '@/service'
import router from './router'
// 引入echart库
import echarts from 'echarts'

Vue.use(ElementUI)
Vue.prototype.service = service
Vue.prototype.$echarts = echarts
Vue.config.productionTip = false

// 路由导航守卫
router.beforeEach((to, from, next) => {
  if (!localStorage.getItem('username')) {
    if (to.path !== '/login') {
      next('/login')
    } else next()
  }
  next()
})

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
